package com.blb.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 自定义控制器
 */
@Controller
@RequestMapping("pages")
public class MyController {

    //配置请求的URL路径 http://localhost:8080/pages/index
//    @RequestMapping(value = "/index",method = RequestMethod.GET)
//    @GetMapping("/index")
//    public String toIndex(){
//        //视图解析器 ： index --> /WEB-INF/page/index.jsp
//        return "index";
//    }
//
//    @GetMapping("/login")
//    public String toLogin(){
//        return "login";
//    }

      @RequestMapping("{page}")
      public String toPage(@PathVariable("page") String page){
          System.out.println("跳转页面：" + page);
          return page;
      }
}
